package HttpUtils;

import android.content.Context;

import http.HttpBodyBase;
import util.BaseTools;

/**
 * Created by Administrator on 2016/1/14.
 */
public class HttpInfoRequest extends HttpBodyBase{
    private int type;
    public HttpInfoRequest(Context context,int type) {
        super(context);
        this.type = type;
        switch (type){
            case 0:
                /**
                 * 获取短信验证码
                 */
                setAction("/index.php/Home/Index/send_verify_code");
                break;
            case 1:
                //登录
                setAction("/index.php/Home/Index/login");
                break;
            case 2:
                //获取我的信息
                setAction("/index.php/Home/Customers/get_user_info");
                break;
            case 3:
                //修改个人信息
                setAction("/index.php/Home/Customers/modify_user_info");
                break;
            case 4:
                //退出登录
                setAction("/index.php/Home/Customers/logout");
                break;
        }

    }

    /**
     * 获取验证码
     *
     * @param mobile
     */
    public void getMobileCode(String mobile){
        params.put("mobile",mobile);
    }

    /**
     * 登录
     * @param mobile
     * @param verifyCode
     */
    public void loginIn(String mobile,String verifyCode){
        params.put("mobile",mobile);
        params.put("verifyCode",verifyCode);
    }

    /**
     * 修改用户资料
     * @param nickName
     * @param sex
     * @param headShotUrl
     */
    public void changeInfo(String nickName,int sex,String headShotUrl){
        if(!BaseTools.isValueEmpty(nickName)){
            params.put("nickName",nickName);
        }

        if(sex>-1){
            params.put("sex",sex);//0是男 1是女
        }
        if(!BaseTools.isValueEmpty(headShotUrl)){
            params.put("headShotUrl",headShotUrl);
        }
    }

    public int getType() {
        return type;
    }
}
